<?php
  if ($is_front) {
    $show_slide = true;
    $show_brand = true;
    $show_brands = false;
    $show_product_menu = false;
    $show_contact = false;
  } else {
    $show_slide = false;
    $show_brand = false;
    $show_brands = false;
    $show_product_menu = false;
    $show_contact = false;

    if (@$page_type) {
      switch ($page_type) {
      // dau's
      case 'tin-tuc':
        $show_brands = true;
        break;
      case 'san-pham':
        $show_slide = true;
        $show_brand = true;
        break;
      case 'lien-he':
        $show_contact = true;
        $show_brands = true;
        break;
      }
    } else if ($node) {
      switch ($node->type) {
      case 'news':
        $show_brands = true;
        break;
      case 'page':
        if (!$is_front) {
          $show_brands = true;
        }
        break;
      case 'xedapdien':
      case 'xemaydien':
        $show_slide = true;
        $show_brand = true;
        $show_product_menu = true;
        $show_brand = false;
        break;
      }
    }
  }
  $theme_path = base_path().path_to_theme()
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
  <head>
    <?php print $head ?>
    <title><?php print $head_title ?></title>
    <?php print $styles ?>
    <?php print $scripts ?>
    <?php /*
    <style type="text/css">
      #link_brands #item1{
          float:left;
          margin-left:4px;
          margin-top:-5px;
       }
      #link_brands #item2{
          float:left;
          margin-left:9px;
          margin-top:-5px;
      }
      #link_brands #item3{
          float:left;
          margin-left:10px;
          margin-top:-5px;
      }
    </style> */ ?>
    <?php if (($node && ($node->type=='xedapdien' || $node->type=='xemaydien')) || $is_front || $page_type=='san-pham'): ?>
      <link rel="stylesheet" type="text/css" href="<?php echo $theme_path ?>/css/style1.css" />
      <link rel="stylesheet" type="text/css" href="<?php echo $theme_path ?>/style.css" />
      <script language="javascript" type="text/javascript" src="<?php echo $theme_path ?>/js/jquery.easing.js"></script>
      <script language="javascript" type="text/javascript" src="<?php echo $theme_path ?>/js/script.js"></script>
    <?php endif ?>
  </head>
  <body<?php print phptemplate_body_class($left, $right); ?>>

<!-- Layout -->
  <div id="header-region" class="clear-block">
    <?php /*print $header; */ ?>
    <div id="content" class="align_center">
      <div id="datetime"><?php print getDateTimeCurrent(); ?></div>
      <div id="content-left">
        <div id="item"><a href="/lien-he">Liên hệ</a></div>
        <div id="item"><a href="#">Hỗ trợ</a></div>
        <div id="item"><a href="#">Đại lý</a></div>
        <div id="item"><img src="<?php echo $theme_path,'/images/rss.png' ?>" />&nbsp;<a href="#">RSS</a></div>
      </div> <!-- end #content-left -->
    </div>
  </div>
  <div id="wrapper" <?php if (!$show_slide) echo 'class="wrapper2"' ?>>
    <div id="container" class="clear-block">

    <div id="header" <?php if (!$show_slide) echo 'class="header2"' ?>>
        <div id="logo-floater">
        <?php print '<a href="'.base_path().'"><img src="'. check_url($logo) .'" alt="'. $site_title .'" id="logo" /></a>' ?>
        </div>
        <?php if ($search_box): ?><div class="block block-theme"><?php print $search_box ?></div><?php endif; ?>
        <?php if (isset($primary_links)) : ?>
          <?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?>
        <?php endif; ?>
      </div> <!-- /header -->
  </div>

  <?php if ($show_slide): ?>
    <?php require('slide.php') ?>
  <?php endif ?>

  <?php if ($show_brand): ?>
    <div id="brand">
      <div class="brand-wrapper">
        <?php $images = array('yamaha', 'honda', 'nishiki') ?>
        <?php foreach ($images as $image): ?>
          <a href="<?php echo base_path(), 'san-pham/', $image ?>"><img src="<?php echo $theme_path,'/images/logo_',$image, '.png' ?>" /></a>
        <?php endforeach ?>
      </div>
    </div>
  <?php endif ?>

  <?php if ($show_brands): ?>
    <div id="container" class="clear-block">
      <div id="brands">
       <div id="_item" style="float: left; width: 325px; ">
          <a  href="<?php echo base_path(),'san-pham/yamaha'?>"><img style="margin: 0px;" src="<?php echo $theme_path,'/images/yamaha_product.png'?>" /></a><br />
          <a href="http://www.yamaha-motor.com.cn"><img style="margin: -5px 0px 0px 4px;" src="<?php echo $theme_path,'/images/yamaha_link.png'?>" /></a>
      </div> <!-- end #_item -->
       <div id="_item" style="float: left; width: 325px; ">
          <a href="<?php echo base_path(),'san-pham/nishiki'?>"><img style="margin: 0px;" src="<?php echo $theme_path,'/images/nishiki_product.png'?>" /></a></br/>
          <a href="http://www.nishiki.com"><img style="margin: -5px 0px 0px 3px;" src="<?php echo $theme_path,'/images/nishiki_link.png'?>" /></a>
       </div> <!-- end #_item -->
        <div id="_item" style="float: left;">
            <a href="<?php echo base_path(),'san-pham/honda'?>"><img style="margin: 0px;" src="<?php echo $theme_path,'/images/honda_product.png'?>" /></a></br>
            <a href="http://www.powersports.honda.com"><img style="margin: -5px 0px 0px 3px;" src="<?php echo $theme_path,'/images/honda_link.png'?>" /></a>
        </div>
      </div> <!-- end #_item -->
    </div>
  <?php endif ?>

  <?php if ($show_product_menu): ?>
    <div id="product-menu">
      <div class="wrapper">
        <?php $pmenus = array(
          'dactinh'=>array('title'=>'Đặc tính nổi bật', 'link'=>'#'),
          'thongso'=>array('title'=>'Thông số', 'link'=>'#'),
          'baogia'=>array('title'=>'Báo giá', 'link'=>'#'),
          'phukien'=>array('title'=>'Phụ kiện', 'link'=>'#'),
        ) ?>
        <?php
            $uri = request_uri();
            if (preg_match('@(.*)/(thongso|dactinh|baogia|phukien).html@', $uri, $match)) {
              $sub_page = $match[2];
              $base_page = $match[1];
            } else {
              $sub_page = 'phukien';
              $base_page = $uri;
            }
        ?>
        <?php $pmenus[$sub_page]['active'] = true ?>
        <ul>
        <?php foreach ($pmenus as $key=>$pmenu): ?>
          <li><span><a href="<?php echo $base_page, '/', $key, '.html' ?>" <?php if (@$pmenu['active']) echo ' class="active"' ?>><?php echo $pmenu['title'] ?></a></span></li>
        <?php endforeach ?>
        </ul>
      </div>
    </div>
  <?php endif ?>

  <div id="container" class="clear-block">
      <div id="center"><div id="squeeze">
          <?php // print $breadcrumb; ?>
          <?php if ($mission): print '<div id="mission">'. $mission .'</div>'; endif; ?>
          <?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?>
          <?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>
          <?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>
          <?php if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif; ?>
          <?php if ($show_messages && $messages): print $messages; endif; ?>
          <?php print $help; ?>
          <div class="clear-block">
          <?php if ($show_contact): ?>
            <div style="float:left;" id="imgcontact">
              <img src="<?php echo $theme_path,'/images/img-contact.jpg' ?>"/>
            </div>
            <div style="padding-left:273px;" id="form-contact">
              <p><span><strong>
                  <span style="color: #0066cc;"> NGHĨA HẢI</span> <span style="color: #0066cc;"> BIKES </span><span style="color: #c0c0c0;">HÀ NỘI</span>
              </strong></span></p>
              <p> <strong><em>Showroom:</em></strong> <span style="font-family: Arial; font-size: small;">77 Tôn Đức Thắng, Đống Đa, Hà Nội <br />
                  Điện thoại: 04-35 160 766<br /> 
                  Hotline: 09 7486 7486 - 0987 99 88 77<br />
                  Email:&nbsp;<a href="mailto:hcm@nghiahai.vn?subject=Xin%20chao%20Nghia%20Hai%20Bikes">hn@nghiahai.vn</a><br />
                  Website: <a href="http://www.nghiahai.vn/">www.nghiahai.vn</a></span></p>
                  <p><span style="font-family: Arial; font-size: small;"><strong>TRUNG TÂM BẢO HÀNH - SỬA CHỮA YAMAHA NGHĨA HẢI</strong><br />
                    77 Tôn Đức Thắng, Đống Đa, Hà Nội </span></p>
              <p><span><span><strong><em>Giờ mở cửa: </em></strong><em>từ 8:00 đến 20:00 (Tất cả các ngày trong tuần)</em></span></span></p>
            </div>
          <?php endif ?>
            <?php print $content ?>
          </div>
          <?php print $feed_icons ?>
          <?php /* dau's */ ?>
          <div id="footer">
            <?php /*print $footer_message . $footer */ ?>
            <img src="<?php echo $theme_path, '/images/logo_small2.png' ?>" />
            <div id="content-left">
              <a href="http://twitter.com"><img src="<?php echo $theme_path, '/images/twitter.png' ?>" width="36" height="36"/></a>
              <a href="http://vn.yahoo.com/?p=us"><img src="<?php echo $theme_path, '/images/yahoo.png' ?>" width="36" height="36"/></a>
              <a href="http://www.facebook.com"><img src="<?php echo $theme_path, '/images/facebook.png' ?>" width="36" height="36"/></a>
              <a href="http://www.flickr.com"><img src="<?php echo $theme_path, '/images/flickr.png' ?>" width="36" height="36"/></a>
              <a href="http://www.youtube.com"><img src="<?php echo $theme_path, '/images/youtube.png' ?>" width="36" height="36"/></a>
            </div>
          </div>
      </div></div> <!-- /#squeeze, /#center -->

      <?php if ($right): ?>
        <div id="sidebar-right" class="sidebar">
          <?php if ($node && ($node->type=='xedapdien' || $node->type=='xemaydien')): ?>
            <?php foreach ($node->taxonomy as $tid=>$term): ?>
              <?php $block = new Stdclass() ?>
              <?php $block->module = 'product' ?>
              <?php $block->subject = 'Sản phẩm cùng dòng' ?>
              <?php $block->delta = 1 ?>
              <?php $block->content = views_embed_view('sanphamcungdong', 'block_1', $tid) ?>
              <?php require('block.tpl.php') ?>
              <?php break ?>
            <?php endforeach ?>
          <?php endif ?>
          <?php print $right ?>
        </div>
      <?php endif; ?>

    </div> <!-- /container -->
  </div>
<!-- /layout -->

  <?php print $closure ?>
  <!-- dau's -->
  <div id="footer-region" class="clear-block">
    <div id="fcontent" class="align_center">
      <div id="fleft">
         Copyright @ 2010 Nghĩa Hải. All rights reserved.
      </div>
      <div id="fright">
        Design By: <a href="http://www.sinhvu.com">sinhvu.com</a>
      </div>
    </div>
  </div>
  </body>
</html>
